package it.truestoryfactory.tsq.setup;

import it.truestoryfactory.tsq.R;
import android.app.Fragment;
import android.net.wifi.p2p.WifiP2pDevice;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

public class InfoFragment extends Fragment {
	
	private View myContentView;
	private WifiP2pDevice myDevice;
	private int numDevices;

	@Override
	public void onActivityCreated(Bundle savedInstanceState) {
		Log.d(this.getClass().getName(), "onActivity created");
		super.onActivityCreated(savedInstanceState);
	}
	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		Log.d(this.getClass().getName(), "onCreate View");
		myContentView= inflater.inflate(R.layout.info_fragment, null);
		return myContentView;
	}

	public void updateDevice(WifiP2pDevice device) {
		myDevice=device;
		TextView view = (TextView) myContentView.findViewById(R.id.myname_device);
		view.setText(myDevice.deviceName);
		
	}

	public void updateNumDevice(int size) {
		numDevices=size;
		TextView view = (TextView) myContentView.findViewById(R.id.num_conn);
		view.setText(Integer.valueOf(numDevices).toString());
		
	}
	
}
